package com.cjy.sql;

import java.io.File;
import java.io.FilenameFilter;

/**
 * @author cjy
 * @create 2020-05-08
 */
public class FileNameFilter {
    class MyFilenameFilter implements FilenameFilter {
        // type为需要过滤的条件，比如如果type=".jpg"，则只能返回后缀为jpg的文件
        private String type;

        public MyFilenameFilter(String type) {
            this.type = type;
        }

        @Override
        // 返回true的文件则合格
        public boolean accept(File dir, String name) {
            return name.endsWith(type);
        }
    }
}
